#include "app_run.h"
#include "app_device.h"
#include "app_bt.h"
#include <unistd.h>
#include <signal.h>

int is_running  = 1;

void exit_func(int sig) {
    is_running = 0;
}

int app_runner_run(void)
{
    // 注册结束信号
    signal(SIGINT, exit_func); // CTRL+C
    signal(SIGTERM, exit_func); // Kill

    Device_t *device = app_device_init(DEVICE_FILE);
    app_bt_init(device);

    app_device_start();

    while (is_running) {
        sleep(1);
    }

    app_device_stop();

    return 0;
}